﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using ElementumForever.Interfaces;
using Microsoft.Xna.Framework;

namespace ElementumForever.CommandPattern
{
    class ChangeXYCommand : ICommand
    {
        protected IEntityProperty entity;
        protected Vector2 oldP, newP;

        public ChangeXYCommand(IEntityProperty entity, float oldX, float newX, float oldY, float newY)
        {
            this.entity = entity;
            oldP = new Vector2(oldX, oldY);
            newP = new Vector2(newX, newY);
            //Console.WriteLine("old:"+oldP+", new:"+newP);
        }

        public virtual void Execute(IsceneBuilder modeler)
        {
            entity.X = newP.X;
            entity.Y = newP.Y;
        }

        public virtual void UnExecute(IsceneBuilder modeler)
        {
            entity.X = oldP.X;
            entity.Y = oldP.Y;
        }
    }
}
